﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wap/Agent/AgentSite.Master" AutoEventWireup="true" CodeBehind="OrderList.aspx.cs" Inherits="ZLCMS.Web.Wap.Agent.OrderList" %>
<%@ Register src="Footer.ascx" tagname="Footer" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">
<div data-role="page" id="mypage">

	<div data-role="header">
	</div><!-- /header -->

	<div role="main" class="ui-content">
    
    	<!--s top_title-->
        <div class="top_title">
        	<!--s tixian_jilu-->
            <div class="tixian_jilu">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td class="data"><input type="text" name="startDate" id="startDate" value="<%=string.Format("{0:yyyy-MM-dd}", Start) %>"</td>
                    <td class="tex">至</td>
                    <td class="data"><input type="text" name="endDate" id="endDate" value="<%=string.Format("{0:yyyy-MM-dd}", End) %>"/></td>
                    <td><a href="#" class="btn" onclick='queryData();'>过滤</a></td>
                  </tr>
                </table>
            </div>
            <!--e tixian_jilu-->
        </div>
        <!--s top_title-->

        <!--s orderList-->
        <div class="orderList">

        </div>
        <!--e orderList-->
        
            	<a data-role="button" data-shadow="false" data-theme="o" id="moreBtn">加载更多</a>
  	</div><!-- /content -->

    <!--S footer -->
	<div data-role="footer" data-position="fixed" data-tap-toggle="false">
                <uc1:Footer ID="Footer1" runat="server" />    
    </div>
    <!--E footer -->
    
</div><!-- /page -->


<script src="/wap/lib/common/listviewHandler.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        queryData();
    });

    function queryData() {
        var handler = $('.orderList').listviewHandler();
        handler.initialize({
            loaderBtn: $('#moreBtn'), //加载数据按钮（点击加载下一页）
            emptyHtml: '无记录', //无记录时显示此html
            itemTemplate: '<div class="box">' +
            	'<ul class="top">' +
                	'<li>订单编号：{OrderNo}</li>' +
                    '<li>总价：<font color="#ff0000">￥{TotalPrice}</font></li>' +
                '</ul>' +
                '{ProductListHtml}' +
                '<div class="othertext">负责人：{AgentAccount}&nbsp;&nbsp;会员：{MemberName}</div>' +
                '<div class="othertext">提成：{BonusAmount}&nbsp;&nbsp;状态：{Status}</div>' +
            '</div>', //项模板
            pageIndex: 1, //页码（从1起算）
            pageSize: 20, //页大小
            totalCount: 999, //总记录数
            itemHandler: function (data, itemTemplate, container) {//数据各项处理
                data.ProductListHtml = '';
                var productTemplate = '<div class="bottom">' +
                	'<div class="left" style="background:url({ThumbnailImg}) no-repeat center; background-size:cover;"></div>' +
                    '<div class="right">' +
                    	'<div class="text">' +
                        	'{ProductName}' +
                        '</div>' +
                        '<p>{Counter}件</p>' +
                    '</div>' +
                '</div>';
                $(data.ProductList).each(function () {
                    this.ThumbnailImg = firstFilePath(this.ThumbnailImg);
                    data.ProductListHtml += productTemplate.format(this);
                });

                data.Status = (data.Status == 1) ? "<span style='color:green'>已生效</span>" : "<span style='color:red'>未生效</span>";
                return itemTemplate.format(data);
            },
            command: 'Agent.LoadOrderList',
            parameter: { AgentAccount: '<%=AgentAccount %>', Start: $('#startDate').val(), End: $('#endDate').val() }
        });
        handler.nextPage();
    }
</script>
</asp:Content>
